package cn.yusei.teamTribe.service.school;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.yusei.teamTribe.dao.school.SchoolRoleDAO;
import cn.yusei.teamTribe.dao.school.po.SchoolRolePO;
import cn.yusei.teamTribe.exception.RoleNotFoundException;

@Service
public class SchoolRoleService {

	@Autowired
	private SchoolRoleDAO schoolRoleDAO;
	
	public int get(int schoolId, int roleId) throws RoleNotFoundException
	{
		SchoolRolePO schoolRolePO = new SchoolRolePO();
		schoolRolePO.setSchoolId(schoolId);
		schoolRolePO.setRoleId(roleId);
		Integer id = schoolRoleDAO.selectTeamMaster(schoolRolePO);
		if(id == null)
			throw new RoleNotFoundException("学校 [" + schoolId + "] 的角色 [" + roleId + "] 不存在");
		return id.intValue();
	}
	
}
